<%@page contentType="text/html; charset=utf-8"%>
<%@ include file="../inc/TagLibs.jsp"%>
<c:set var="pageTitle" value="消息提醒设置" />
<%@ include file="../inc/Title.jsp"%>
<head>
<link rel="stylesheet" type="text/css" href="/css/base.css" />
<style>
	.chit-cau li{padding:6px 0; border-bottom:1px solid #eee;}
	.chit-cau li table{margin-left:24px;}
	.chit-cau li th,.chit-cau li td{ padding:3px 0; vertical-align:top;} 
	.chit-cau li th{ width:60px; color:#666; text-align:right; padding-right:10px;}
</style>
<script src="/js/popup_ext.js"></script>
<script language="javascript">
	function doSave(){
		document.getElementById("buttonDiv").style.display="none";
		document.getElementById("waitDiv").style.display="";
		var num=${fn:length(list)};
		var hasError="0";
		for(var i=0;i<num;i++){
			var cc=document.getElementById("cycle"+i);
			if(cc!=null){
				if(cc.value=="" || isNaN(cc.value)){
					hasError="1";
					break;
				}else if(Number(cc.value)<1){
					hasError="1";
					break;
				}
			}
		}
		if(hasError=="1"){
			ShowAlert('提示框','提醒间隔只能输入大于0的整数！',200,100);
			document.getElementById("buttonDiv").style.display="";
			document.getElementById("waitDiv").style.display="none";
		}else{
			frm.submit();
		}
	}
	function doCancel(){
		window.close();
	}
	function showDetail(stafferId,stafferName,year,month){
		var url="/sms/SmsHistoryDetail.ihtm?staffer_id="+stafferId+"&staffer_name="+encodeURIComponent(stafferName)+"&year="+year+"&month="+month;
		showWin(900,500,url);
	}
	function showReceiver(alertId){
		var url="/sms/SmsReceiverList.ihtm?alert_id="+alertId;
		showWin(300,400,url);
	}
	function doInit(){
	}
</script>
</head>
<body class="sheet modal-dialog" onload="doInit();" style="padding-top:10px;text-align:center;">
<div class="sheet-main" id="bodyDiv" style="width:480px;text-align:left;margin:auto;">
	<form name="frm" method="post">
	  <div class="sheet-list" style="width:100%">
		    <div class="modal-main search-business">
		    	<div style="width:100%;">
					<c:set var="pageTopTitle" value="消息提醒设置" />
					<%@ include file="../inc/PageTop.jsp"%>
					
					<ul class="chit-cau">
						<c:forEach var="sa" items="${list}" varStatus="i">
						<li>
							<p>
								<input <c:if test="${sa.status=='Y'}">checked</c:if> type="checkbox" name="status${sa.id}" value="1">
								<strong>${sa.title}</strong>
							</p>
							<table>
								<c:if test="${sa.ptType!=null && sa.ptType!='' || sa.innerRec=='Y'}">
								<tr>
									<th><c:if test="${sa.ptType=='TIME'}">发送时间：</c:if><c:if test="${sa.ptType=='CYCLE'}">提醒间隔：</c:if></th>
									<td>
										<c:if test="${sa.ptType=='TIME'}">
											<select id="pt_hour${i.index}" name="pt_hour${sa.id}">
												<c:forEach var="item" begin="0" step="1" end="23" varStatus="i"><c:if test="${i.index<10}"><c:set var="item" value="0${item}" /></c:if><option value="${item}" <c:if test="${sa.ptHour==item}">selected</c:if>>${item}</option></c:forEach>
											</select>
											:
											<select id="pt_minute${i.index}" name="pt_minute${sa.id}">
												<c:forEach var="item" begin="0" step="1" end="59" varStatus="i"><c:if test="${i.index<10}"><c:set var="item" value="0${item}" /></c:if><option value="${item}" <c:if test="${sa.ptMinute==item}">selected</c:if>>${item}</option></c:forEach>
											</select>
										</c:if>
										<c:if test="${sa.ptType=='CYCLE'}">
											<input type="text" class="TextBox" style="width:30px" id="cycle${i.index}" name="cycle${sa.id}" value="${sa.alertCycle}">分钟
										</c:if>
										<c:if test="${sa.innerRec=='Y'}">
											<span><a href="javascript:showReceiver(${sa.id});">设置接收人员...</a></span>
										</c:if>
									</td>
								</tr>
								</c:if>
								<c:if test="${sa.mark!=null && sa.mark!=''}">
								<tr>
									<th>说明：</th>
									<td>${sa.mark}</td>
								</tr>
								</c:if>
								<c:if test="${sa.content!=null && sa.content!=''}">
								<tr>
									<th>内容：</th>
									<td>${sa.content}<c:if test="${sa.useCustom=='Y'}"><br><input type="text" class="TextBox" style="width:300px" maxlength="25" id="custom_txt${i.index}" name="custom_txt${sa.id}" value="${sa.customTxt}"></c:if></td>
								</tr>
								</c:if>
								<c:if test="${sa.canSms=='Y'}">
								<!--
								<tr>
									<td colspan="2">
										<input type="checkbox" name="sms_flag${sa.id}" id="sms_flag${i.index}" value="1" <c:if test="${sa.smsFlag=='Y'}">checked="true"</c:if>>
										发手机短信（如果选中，除了发系统消息外，还会发手机短信通知）
									</td>
								</tr>
								-->
								</c:if>
							</table>
						</li>
						</c:forEach>
					</ul>
				</div>
		    </div>
	   </div>
		<div class="modal-buttom" id="buttonDiv">
			<input type="button" class="buttom" value=" 保 存 " onClick="doSave();">
			<input type="button" class="buttom" value=" 取 消 " onClick="doCancel();">
		    <input type="hidden" id="flag" name="flag" value="1">
		</div>	
		<div class="modal-buttom" id="waitDiv" style="display:none">
			<span style="color:#ffffff">请稍候...</span>
		</div>
	 </form> 
</div>
</body>
</html>